/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.conseilimmo.repository;

import com.hildeberto.home.util.EntityManagerHelper;
import java.util.List;
import javax.persistence.EntityManager;
import objetsBd.DepenseBd;

/**
 *
 * @author verpoorten
 */
public class DepenseBsn {
     private EntityManager em = EntityManagerHelper.EM.open();
    
    public List<DepenseBd> trouverListeDepenses() {
        String sql = "select b from DepenseBd  b";
        return em.createQuery(sql).getResultList();
    }

    public DepenseBd trouverDepenseParId(Long idDepense) {
        String sql = "select b from DepenseBd  b";
        sql += " where b.idDepense = :idDepense";
        return (DepenseBd) em.createQuery(sql).setParameter("idDepense", idDepense).getSingleResult();
    }

}
